package com.insmess.speech.controller;

import com.insmess.speech.common.api.CommonResult;
import com.insmess.speech.service.VoiceprintService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Slf4j
@RestController
@RequestMapping("/vocieprint")
public class VoiceprintController {
    @Autowired
    private VoiceprintService voiceprintService;
    @PostMapping("/compare")
    public CommonResult compare(MultipartFile fileOne, MultipartFile fileTwo) {
        try {
            Double d = voiceprintService.comapreByFile(fileOne, fileTwo);
            return CommonResult.success(d);
        } catch (Exception e) {
            e.printStackTrace();
            return CommonResult.failed(e.getMessage());
        }
    }
}
